import 'dart:convert' show json;

import 'package:x3_base_package/x3_base_package.dart';
import 'package:x3_business_core/common_models/base_business_model.dart';

class DepotModel extends BaseBusinessModel {
  DepotModel({
    this.depotName,
    this.depotId,
    this.depotImage,
    this.depotCity,
    this.depotBusinessStateName,
    this.commonSortName,
    bool check,
  }) : super(depotId, depotName, check: check);

  factory DepotModel.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : DepotModel(
          depotName: asT<String>(jsonRes['depotName']),
          depotId: asT<String>(jsonRes['depotId']),
          depotImage: asT<String>(jsonRes['depotImage']),
          depotCity: asT<String>(jsonRes['commonCity']),
          depotBusinessStateName: asT<String>(jsonRes['depotBusinessStateName']),
          commonSortName: asT<String>(jsonRes['commonSortName']),
          check: asT<bool>(jsonRes['check']),
        );

  String depotName;
  String depotId;
  String depotImage;
  String depotCity;
  String depotBusinessStateName;
  String commonSortName;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'depotName': depotName,
        'depotId': depotId,
        'depotImage': depotImage,
        'depotCity': depotCity,
        'depotBusinessStateName': depotBusinessStateName,
        'commonSortName': commonSortName,
      };
  @override
  String toString() {
    return json.encode(this);
  }
}
